package com.rogue.blog.service.article;

import com.rogue.blog.model.dto.article.ArticleDTO;
import com.rogue.blog.model.po.PageBean;
import com.rogue.blog.model.po.PageCondition;
import com.rogue.blog.model.vo.article.ArticleCardVO;
import com.rogue.blog.model.vo.article.ArticleVO;

/**
 * Created by 86101 on 2018-10-22.
 */
public interface ArticleService {
    /**
     * 添加记录，返回主键
     *
     * @param dto
     * @return
     */
    long insert(ArticleDTO dto);

    /**
     * 根据id删除记录
     *
     * @param id
     * @param hardDelete
     * @return
     */
    int deleteById(long id, boolean hardDelete);

    /**
     * 根据id更新记录
     * @param id
     * @param po
     * @return
     */
    int updateById(long id, ArticleDTO po);

    /**
     * 根据id查询记录
     *
     * @param id
     * @return
     */
    ArticleVO selectById(long id);

    /**
     * 分页查询记录
     *
     * @param currentPage
     * @param pageSize
     * @param search
     * @return
     */
    PageBean<ArticleCardVO> selectByPage(int currentPage, int pageSize, String search);

    /**
     * 除了指定文章是否存在同名文章
     *
     * @param articleName
     * @param articleName
     * @return
     */
    boolean exists(String articleName, long articleId);
}
